﻿using System;
using System.Collections.Generic;
using MassIntellect.WorkIt;

namespace AIS2
{
	public class Error
	{
		public string Description { get; set; }

		public ErrorLevel Level { get; set; }

        public Guid ObjectRef { get; set; }

		//public readonly HashSet<string> Tags = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);

		public static implicit operator Error(string descEr)
		{
			return new Error { Description = descEr };
		}

		public override string ToString()
		{
			return Description;
		}

		public static Error Get(string descError, ErrorLevel level)
		{
			return new Error {Description = descError, Level = level};
		}

		public static Error Get<Tclass>(string descError, ErrorLevel level, Tclass subject)
		{
			return new Error<Tclass> { Description = descError, Level = level, Subject = subject };
		}
	}

	public class Error<Tclass>: Error
	{
		public Tclass Subject { get; set; }

		public new static Error Get(string descError, ErrorLevel level)
		{
			return new Error<Tclass> { Description = descError, Level = level };
		}

		public static Error Get(string descError, ErrorLevel level, Tclass subject)
		{
			return new Error<Tclass> { Description = descError, Level = level, Subject = subject };
		}
	}
}
